<?php
if(isset($_POST['submit'])){
	sendEmail();
	 header('Location: success');
}
function sendEmail(){
 //	$mail  =Yii::app()->mailer;
	$name=$_POST['name'];
	$phone=$_POST['phone'];
	$address=$_POST['address'];
	$time=$_POST['time'];
	$accesser=$_POST['accesser'];
	$bankname=$_POST['bankname'];
	$account=$_POST['account'];
	$bank_name=$_POST['bank_name'];
	$bank_address=$_POST['bank_address'];
	$msg = "姓名:\t$name\n";
	$msg .= "手机号码:\t$phone\n";
	$msg .= "地址:\t$address\n";
	$msg .= "上门时间:\t$time\n";
	$msg .= "收款人:\t$accesser\n";
	$msg .= "银行名称:\t$bankname\n";
	$msg.="账号:\t$account\n";
	$msg.="开户银行名称:\t$bank_name\n";
	$msg.="开户银行地址:\t$bank_address\n";
	//$recipient = "marshall.ma@webnova.net.au,andy.szeto@webnova.net.au,aaron.zhao@webnova.net.au,j.bao@webnova.net.au,b.huang@netcube.com.au,m.chen@webnova.com.au"; 
	//$recipient = "allen6203@qq.com"; 
	$recipient = "chinadevicereturn@webnova.net.au";
	$subject = "异地设备返还申请";
	$mailheaders = "From: Netcube Control Panel <admin@netcube.com.au> \n"; 
	$mailheaders .= "Reply-To: $sender_email\n\n";
	mail($recipient, $subject, $msg, $mailheaders);	
}
Yii::app()->clientScript->registerScript('search', "
$(document).ready(function(){
  $('#send').click(function(){
	var name = document.myform.name; 
	var phone = document.myform.phone; 
	var address = document.myform.address; 
	var time = document.myform.time;
	var accesser=document.myform.accesser;
	var bankname=document.myform.bankname;
	var account=document.myform.account;
	if(name.value.length==0){ 
	document.getElementById('formmanage').innerHTML=\"请填写姓名\";
	name.focus(); 
	return false; 
	}else if(phone.value.length==0){ 
	document.getElementById('formmanage').innerHTML=\"请填写手机号码\";
	phone.focus(); 
	return false; 
	}else if(address.value.length==0){ 
	document.getElementById('formmanage').innerHTML=\"请填写地址\";
	address.focus(); 
	return false; 
	}else if(time.value.length==0){
	document.getElementById('formmanage').innerHTML=\"请填写上门时间\";
	time.forcus();
	return false;
	}else if(accesser.value.length==0){
	document.getElementById('formmanage').innerHTML=\"请填写收款人\";
	time.forcus();
	return false;
	}else if(bankname.value.length==0){
		document.getElementById('formmanage').innerHTML=\"请填写银行名称\";
		bankname.forcus;
		return false;
	}else if(account.value.length==0){
		document.getElementById('formmanage').innerHTML=\"请填写账号\";
		account.forcus;
		return false;
	}
});
});
");
?>

<form name="myform" method="post" action="">
  <div>
	<div id="formmanage">
	</div>
  <table>
 	<tr>
  	<th colspan="2">基本信息</th>
  	</tr>
    <tr>
      <td> 姓 名<span style="color:red;">*</span> </td>
      <td><input type="text" name="name" /></td>
    </tr>
    <tr>
      <td>手机电话<span style="color:red;">*</span></td>
      <td><input type="text" name="phone" /></td>
    </tr>
    <tr>
  	<th colspan="2">上门回收信息</th>
  	</tr>
    <tr>
      <td> 地址<span style="color:red;">*</span></td>
      <td><input type="text" name="address" /></td>
    </tr>
 	<tr>
      <td>上门时间<span style="color:red;">*</span></td>
      <td><input class="Wdate" type="text" name="time" 
 value="<?php echo date("Y-m-d H:i:s");?>" onClick="WdatePicker({startDate:'%y-%M-01 00:00:00',dateFmt:'yyyy-MM-dd HH:mm:ss',alwaysUseStartDate:true})" /></td>
    </tr>
    <tr>
  	<th colspan="2" >退换押金信息</th>
  	</tr>
     <tr>
      <td>收款人<span style="color:red;">*</span></td>
      <td><input type="text" name="accesser" /></td>
    </tr>
     <tr>
      <td>银行名称<span style="color:red;">*</span></td>
      <td><input type="text" name="bankname" /></td>
    </tr>
     <tr>
      <td>账号<span style="color:red;">*</span></td>
      <td><input type="text" name="account" /></td>
    </tr>
    <tr>
      <td>开户银行名称  </td>
      <td><input type="text" name="bank_name" /></td>
    </tr>
         <tr>
      <td>开户银行地址  </td>
      <td><input type="text" name="bank_address" /></td>
    </tr>
       <tr>
      <td>&nbsp;</td>
      <td><label>
          <input type="submit" name="submit" value="发送" id="send"/>
        </label></td>
    </tr>
  </table>
</form>
